﻿using System.Web.Mvc;
using LeanBoard.Models;

namespace LeanBoard.Controllers
{
    public class LeanBoardController : Controller
    {
        private IDataProvider _dataProvider = new DataProvider();

        public ActionResult Index(string team, string release, string filterAll)
        {
            var itemsCollection = _dataProvider.GetItems(team, release, filterAll);

            return View(itemsCollection);
        }

        public ActionResult ReadOnly(string team, string release, string filterAll)
        {
            var itemsCollection = _dataProvider.GetItems(team, release, filterAll);

            return View(itemsCollection);
        }

        public ActionResult QA(string team, string release, string filterAll)
        {
            var itemsCollection = _dataProvider.GetItems(team, release, filterAll);

            return View(itemsCollection);
        }

        [HttpPost]
        public JsonResult Move(Item item)
        {
            DominoActionResult result = _dataProvider.MoveItem(item);
            return Json(result);
        }

        [HttpPost]
        public JsonResult Assign(string itemUnid, string name, string leanStatus, string type)
        {
            DominoActionResult result = _dataProvider.Assign(itemUnid, name, leanStatus, type);
            return Json(result);
        }
    }
}
